app.controller('layoutCtrl', function($rootScope,$scope, httpService,toaster,$localStorage,$state){
     //获取个人信息
     $rootScope.userInfo=$localStorage.userInfo;
     //设置个人信息弹框处理
     $rootScope.settingModle= function(){
         $rootScope.settingInfo={};
         //重置表单元素
         $scope.settingForm.$setPristine();
         $('#settingModal').modal('show');
    }
    //个人信息表单提交
     $rootScope.settingFormSubmit = function(){
        var path = "/account/changepwd/" +  $rootScope.userInfo.id;
        var type = "PUT";
         $scope.settingForm.$invalid = true;
        httpService.request(type, path, $rootScope.settingInfo, function(result){
            $scope.settingForm.$invalid = false;
            toaster.pop("success", "提示", result.message);
            $('#settingModal').modal('hide');
        });
    }
    $rootScope.onLogout=function(){
        $state.go('login');
    }
});
